﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TDUpdate
{
    public class DebugInformations : UpdateComponent
    {
        public float FramesPerSecond 
        { 
            get { return frameRate; }
            set { frameRate = value; OnPropertyChanged("FramesPerSecond"); }
        }
        private float frameRate;

        private float elapsed;
        private float frames;

        public override void Update()
        {
            // Frames per seconds
            elapsed += (float)UpdateManager.GameTime.ElapsedGameTime.TotalSeconds;

            if (elapsed > 1.0f)
            {
                FramesPerSecond = frames;
                elapsed -= 1.0f;
                frames = 0;
            }
            else
            {
                frames += 1;
            }
        }
    }
}
